package com.ruoyi.service.jpjs.profit.impl;

import com.ruoyi.common.constant.MsgConstants;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.domain.jpjs.common.municipal.Income;
import com.ruoyi.domain.jpjs.common.municipal.IncomeDetail;
import com.ruoyi.domain.jpjs.common.municipal.IncomeParam;
import com.ruoyi.domain.jpjs.common.profit.Profit;
import com.ruoyi.mapper.jpjs.income.IncomeMapper;
import com.ruoyi.mapper.jpjs.profit.ProfitMapper;
import com.ruoyi.service.jpjs.profit.ProfitService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @explain 市政收入 业务层处理
 */
@Service
public class ProfitServiceImpl implements ProfitService {

    @Resource
    private ProfitMapper profitMapper;

    @Override
    public List<Profit> queryProfitList(Profit profit) {
        return profitMapper.queryProfitList(profit);
    }


    @Override
    public int addProfit(Profit profit) {
        return profitMapper.addProfit(profit);
    }

    @Override
    public int updateProfit(Profit profit) {
        return  profitMapper.updateProfit(profit);
    }

    @Override
    public String checkActualMonthUnique(Profit profit) {
        int actualCount = profitMapper.checkActualMonthUnique(profit);
        if (actualCount > 0) {
            return MsgConstants.MONTH_NOT_UNIQUE;
        }
        return MsgConstants.MONTH_UNIQUE;
    }

    @Override
    public String checkActualMonthUniqueEdit(Profit profit) {
        int actualCount = profitMapper.checkActualMonthUniqueEdit(profit);
        if (actualCount > 0) {
            return MsgConstants.MONTH_NOT_UNIQUE;
        }
        return MsgConstants.MONTH_UNIQUE;
    }

    @Override
    public int deleteProfitById(String profitIds) {
        String[] profitId = Convert.toStrArray(profitIds);
        return profitMapper.deleteProfitById(profitId);
    }

    @Override
    public Profit queryAcutalProfit(Profit profit) {
        return profitMapper.queryAcutalProfit(profit);
    }
}
